<!DOCTYPE html>
<html  lang="en">
<head>
    <meta charset="utf-8">
<title>Rust概念-所有权 - noback</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />



    <meta name="description" content="Rust概念-所有权变量类型可以看一下这两篇文章https:&#x2F;&#x2F;learning-rust.github.io&#x2F;docs&#x2F;a6.variable_bindings,constants_and_statics.htmlhttp:&#x2F;&#x2F;wiki.jikexueyuan.com&#x2F;project&#x2F;rust&#x2F;primitive-types.html 在rust中变量模式是不可变的，因此我们叫做变量绑定，为了使">
<meta property="og:type" content="article">
<meta property="og:title" content="Rust概念-所有权">
<meta property="og:url" content="http://alpaca-h.gitee.io/2019/12/28/blog_back_new/Rust/rust%E5%9F%BA%E7%A1%80/61-rust%E6%89%80%E6%9C%89%E6%9D%83/index.html">
<meta property="og:site_name" content="noback">
<meta property="og:description" content="Rust概念-所有权变量类型可以看一下这两篇文章https:&#x2F;&#x2F;learning-rust.github.io&#x2F;docs&#x2F;a6.variable_bindings,constants_and_statics.htmlhttp:&#x2F;&#x2F;wiki.jikexueyuan.com&#x2F;project&#x2F;rust&#x2F;primitive-types.html 在rust中变量模式是不可变的，因此我们叫做变量绑定，为了使">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="http://alpaca-h.gitee.io/images/og_image.png">
<meta property="article:published_time" content="2019-12-28T13:56:19.000Z">
<meta property="article:modified_time" content="2019-12-29T03:16:04.707Z">
<meta property="article:author" content="Alpaca">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://alpaca-h.gitee.io/images/og_image.png">







<link rel="icon" href="/images/favicon.svg">


<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.7.2/css/bulma.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu:400,600|Source+Code+Pro">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@9.12.0/styles/androidstudio.css">


    
    
    
    <style>body>.footer,body>.navbar,body>.section{opacity:0}</style>
    

    
    
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lightgallery@1.6.8/dist/css/lightgallery.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/css/justifiedGallery.min.css">
    

    
    

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/outdatedbrowser@1.1.5/outdatedbrowser/outdatedbrowser.min.css">


    
    
    
    

<link rel="stylesheet" href="/css/back-to-top.css">


    
    

    
    
    
    

    
    
<link rel="stylesheet" href="/css/progressbar.css">
<script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>

    
    
    

    
    
    
        <script async="" src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    

    


<link rel="stylesheet" href="/css/style.css">
<meta name="generator" content="Hexo 4.2.0"><link rel="alternate" href="/atom.xml" title="noback" type="application/atom+xml">
</head>
<body class="is-3-column">
    <nav class="navbar navbar-main">
    <div class="container">
        <div class="navbar-brand is-flex-center">
            <a class="navbar-item navbar-logo" href="/">
            
                <img src="/images/logo.svg" alt="Rust概念-所有权" height="28">
            
            </a>
        </div>
        <div class="navbar-menu">
            
            <div class="navbar-start">
                
                <a class="navbar-item"
                href="/">Home</a>
                
                <a class="navbar-item"
                href="/archives/">Archives</a>
                
                <a class="navbar-item"
                href="/categories/">Categories</a>
                
                <a class="navbar-item"
                href="/tags/">Tags</a>
                
                <a class="navbar-item"
                href="/about/">About</a>
                
            </div>
            
            <div class="navbar-end">
                
                    
                    
                    <a class="navbar-item" target="_blank" title="AlphaLxy GitHub" href="https://www.github.com/AlphaLxy">
                        
                        <i class="fab fa-github"></i>
                        
                    </a>
                    
                
                
                <a class="navbar-item is-hidden-tablet catalogue" title="Catalogue" href="javascript:;">
                    <i class="fas fa-list-ul"></i>
                </a>
                
                
                <a class="navbar-item search" title="Search" href="javascript:;">
                    <i class="fas fa-search"></i>
                </a>
                
            </div>
        </div>
    </div>
</nav>
    
    <section class="section">
        <div class="container">
            <div class="columns">
                <div class="column is-8-tablet is-8-desktop is-9-widescreen has-order-2 column-main"><div class="card">
    
    <div class="card-content article ">
        <h1 class="title is-size-3 is-size-4-mobile has-text-weight-normal">
            
                <i class="fas fa-angle-double-right"></i>Rust概念-所有权
            
        </h1>
        
        <div class="level article-meta is-size-7 is-uppercase is-mobile is-overflow-x-auto">
            <div class="level-left">
                <time class="level-item has-text-grey" datetime="2019-12-28T13:56:19.000Z"><i class="far fa-calendar-alt">&nbsp;</i>2019-12-28</time>
                
                <time class="level-item has-text-grey is-hidden-mobile" datetime="2019-12-29T03:16:04.707Z"><i class="far fa-calendar-check">&nbsp;</i>2019-12-29</time>
                
                
                <div class="level-item">
                <i class="far fa-folder-open has-text-grey"></i>&nbsp;
                <a class="has-link-grey -link" href="/categories/blog-back-new/">blog_back_new</a>&nbsp;/&nbsp;<a class="has-link-grey -link" href="/categories/blog-back-new/Rust/">Rust</a>
                </div>
                
                
                <span class="level-item has-text-grey">
                    <i class="far fa-clock"></i>&nbsp;
                    
                    
                    10 minutes read (About 1550 words)
                </span>
                
                
                <span class="level-item has-text-grey" id="busuanzi_container_page_pv">
                    <i class="far fa-eye"></i>
                    <span id="busuanzi_value_page_pv">0</span> visits
                </span>
                
            </div>
        </div>
        
        <div class="content">
            <h2 id="Rust概念-所有权"><a href="#Rust概念-所有权" class="headerlink" title="Rust概念-所有权"></a>Rust概念-所有权</h2><h3 id="变量类型"><a href="#变量类型" class="headerlink" title="变量类型"></a>变量类型</h3><p>可以看一下这两篇文章<br><a href="https://learning-rust.github.io/docs/a6.variable_bindings,constants_and_statics.html" target="_blank" rel="noopener">https://learning-rust.github.io/docs/a6.variable_bindings,constants_and_statics.html</a><br><a href="http://wiki.jikexueyuan.com/project/rust/primitive-types.html" target="_blank" rel="noopener">http://wiki.jikexueyuan.com/project/rust/primitive-types.html</a></p>
<p>在rust中变量模式是不可变的，因此我们叫做变量绑定，为了使他们可变，使用mut关键字即可<br>rust是一种静态类型的语言；它在编译时检查数据类型。并不需要在声明变量绑定时指定一个具体的数据类型。编译器会检查使用情况并为其设置更好的数据类型。<br>但是对于 <font color='red'>常量和静态变量</font>，必须注释type。类型在冒号（:)之r</p>
<h3 id="变量绑定"><a href="#变量绑定" class="headerlink" title="变量绑定"></a>变量绑定</h3><pre><code class="rust">// 变量绑定
let a = true;
let b: bool = true; 
// 以上可以声明具体的数据类型，也可以不指定

let (x,y) = (1,2);

let mut z = 5;
z = 6;

// 常数  必须指定
const N: i32 = 5;

// 静态变量
static N: i32 = 6;</code></pre>
<h3 id="所有权"><a href="#所有权" class="headerlink" title="所有权"></a>所有权</h3><p>在rust中，一共分为两种数据类型</p>
<ol>
<li>基本数据类型： 如：bool（布尔），char（字符）,integer（整数）,floating（浮点）,arrays（数组），tuples(元组)，slice(切片),字符串（str），函数指针(functions)</li>
<li>非基本数据类型 也就是引用类型</li>
</ol>
<p>在rust中，对于所有权一共有两种动作状态  移动和copy</p>
<ul>
<li>复制<br>当将a赋值给b的时候，首先rust会对原来a的元数据进行复制，并将复制的数据赋值给b，并把a的所有权状态 设置为“已复制（ copied ）”状态。</li>
<li>移动<br>当将a赋值给b的时候，rust会把原来对a的原数据的所有权移动给b，并把a的所有权状态 设置为“已移动（ moved ）”状态。<pre><code class="rust">let x = 5;
let y = x;
// 基本数据类型 只发生了copied
let x = String::from(&quot;hello world&quot;);
let y = x;
// 引用数据类型，发生了moved</code></pre>
<img src="http://img.noback.top/2019-12-28-23-30-18.png" alt="2019-12-28-23-30-18"><br>引用类型在存储到堆中时，会指定三个部分 分别时指针，长度和容量，并且指针指向堆上存放内存的内存地址<br>长度表示 String 的内容当前使用了多少字节的内存。容量是 String 从操作系统总共获取了多少字节的内存。长度与容量的区别是很重要的，</li>
</ul>
<h3 id="复制行为"><a href="#复制行为" class="headerlink" title="复制行为"></a>复制行为</h3><p><img src="http://img.noback.top/2019-12-28-23-32-47.png" alt="2019-12-28-23-32-47"><br>复制行为中，拷贝了一整份内容，包括指针长度和容量，于是他们共用同一个内存，而不是分别指向相等的两个内存<br><font color='red'>二次释放错误</font><br>当变量离开作用域的使用,Rust自动调用drop函数并清理变量的堆内存，于是当出现复制行为的时候，他们执行的内存地址是相同的，当s1离开后，s2执行的内存地址无。当s1离开后，s2执行的内存地址无，这个叫做二次释放的错误，也是之前提到过的内存安全性 bug 之一。两次释放（相同）内存会导致内存污染，它可能会导致潜在的安全漏洞。<br><font color='blue'>但是我在代码中试了一下，没有报错。。。</font></p>
<pre><code class="rust">fn main() {
     let x = 1;
     let y = x;
     println!(&quot;Hello, world!{}&quot;,y);
     println!(&quot;{}&quot;,x)
} 
// input
Hello, world!1
1</code></pre>
<h3 id="移动行为"><a href="#移动行为" class="headerlink" title="移动行为"></a>移动行为</h3><p><img src="http://img.noback.top/2019-12-28-23-43-58.png" alt="2019-12-28-23-43-58"><br>如果将原变量指针移向另外一个变量指针，原变量指针失效。当你再次调用s1变量时，由于指针的失去，没有指向存储数据的内存地址，报错无效引用</p>
<pre><code class="rust">fn main() {
    let x = String::from(&quot;hello&quot;); // 这个是引用类型。数据在堆上面
    let y = x;
    println!(&quot;Hello, world!{}&quot;,y);
    println!(&quot;{}&quot;,x)
}

// input
error[E0382]: borrow of moved value: `x`
 --&gt; src/main.rs:5:19
  |
2 |     let x = String::from(&quot;hello&quot;);
  |         - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
3 |     let y = x;
  |             - value moved here
4 |     println!(&quot;Hello, world!{}&quot;,y);
5 |     println!(&quot;{}&quot;,x)
  |                   ^ value borrowed here after move

error: aborting due to previous error

For more information about this error, try `rustc --explain E0382`.
error: could not compile `xx`.

To learn more, run the command again with --verbose.
// 指针报错
指针已经被move</code></pre>
<h3 id="克隆行为"><a href="#克隆行为" class="headerlink" title="克隆行为"></a>克隆行为</h3><p>对于基础类型来说，变量的数据交互形式是复制<br>对于引用类型来说，变量的数据交互形式无法复制，只能移动。但是如果我们需要使用到复制堆上的数据，可以使用clone的通用函数</p>
<pre><code class="rust">fn main() {
    let x = String::from(&quot;hello&quot;); // 这个是引用类型。数据在堆上面
    let y = x.clone();
    println!(&quot;Hello, world!{}&quot;,y);
    println!(&quot;{}&quot;,x)
} </code></pre>
<h2 id="引用和借用"><a href="#引用和借用" class="headerlink" title="引用和借用"></a>引用和借用</h2><h3 id="不可变引用"><a href="#不可变引用" class="headerlink" title="不可变引用"></a>不可变引用</h3><p>跳过所有权，引用对象数据，这里就要用到rust中的引用关键字&amp;<br>&amp;关键字作用是创建了一条指向某一对象的引用，再由引用对象指向数据错在内存地址<br>当引用本身&amp;s1离开作用域后，调用drop函数，指向s1对象的指针被丢弃<br>同时，rust的引用本身也是不可变的，</p>
<pre><code class="rust">fn main() {
    let s1 = String::from(&quot;hello&quot;);

    let len = calculate_length(&amp;s1);

    println!(&quot;The length of &#39;{}&#39; is {}.&quot;, s1, len);
}

//参数类型需要引用类型
fn calculate_length(s: &amp;String) -&gt; usize {
    s.len()
}</code></pre>
<p><img src="http://img.noback.top/2019-12-29-09-38-03.png" alt="2019-12-29-09-38-03"><br>以上 &amp;s1的过程称为引用，获取因果那个作为函数参数称为借用</p>
<h3 id="可变引用"><a href="#可变引用" class="headerlink" title="可变引用"></a>可变引用</h3><p>可变引用同不可变类似，但要保证<br>被引用类型为可变类型<br>引用为可变<br>函数参数为可变引用</p>
<pre><code class="rust">fn main() {
    let mut s = String::from(&quot;hello&quot;);
    change(&amp;mut s);
}
fn change(some_string: &amp;mut String) {
    some_string.push_str(&quot;, world&quot;);
}</code></pre>
<p><font color='blue'>在特定作用域中的特定数据有且只有一个可变引用。这些代码会失败;但可以有多个不可变引用,并且不可变引用和可变引用不能同时存在，可以在其中一个小时后再调用</font><br>解决</p>
<pre><code class="rust">let mst s = String::from(&quot;hello&quot;)
{
  let r1 = &amp;mut s;
} 
let r2 = &amp;mut s;</code></pre>
<h2 id="slice-切片"><a href="#slice-切片" class="headerlink" title="slice 切片"></a>slice 切片</h2><pre><code class="rust">let s = String::from(&quot;hello world&quot;) 
let hello = &amp;s[..5];
// let hello = &amp;s[0..5];
let world = &amp;s[6..11];
// let world = &amp;s[6..len];

let helloworld = &amp;s[..];
let helloworld = &amp;s[0..len];
</code></pre>

        </div>
        
            <ul class="post-copyright">
            <li><strong>本文标题：</strong><a href="http://alpaca-h.gitee.io/2019/12/28/blog_back_new/Rust/rust%E5%9F%BA%E7%A1%80/61-rust%E6%89%80%E6%9C%89%E6%9D%83/">Rust概念-所有权</a></li>
            <li><strong>本文作者：</strong><a href="http://alpaca-h.gitee.io">Alpaca</a></li>
            <li><strong>本文链接：</strong><a href="http://alpaca-h.gitee.io/2019/12/28/blog_back_new/Rust/rust%E5%9F%BA%E7%A1%80/61-rust%E6%89%80%E6%9C%89%E6%9D%83/">http://alpaca-h.gitee.io/2019/12/28/blog_back_new/Rust/rust%E5%9F%BA%E7%A1%80/61-rust%E6%89%80%E6%9C%89%E6%9D%83/</a></li>
            <li><strong>发布时间：</strong>2019-12-28</li>
            <li><strong>版权声明：</strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" rel="external nofollow" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明出处！
            </li>
            </ul>
        
        
        
        
    </div>
</div>





<div class="card card-transparent">
    <div class="level post-navigation is-flex-wrap is-mobile">
        
        <div class="level-start">
            <a class="level level-item has-link-grey  article-nav-prev" href="/2019/12/29/blog_back_new/Rust/rust%E5%9F%BA%E7%A1%80/rust%E7%BB%93%E6%9E%84%E4%BD%93/">
                <i class="level-item fas fa-chevron-left"></i>
                <span class="level-item">rust结构体</span>
            </a>
        </div>
        
        
        <div class="level-end">
            <a class="level level-item has-link-grey  article-nav-next" href="/2019/12/27/blog_back_new/Python/python%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%951/">
                <span class="level-item">Python常用方法</span>
                <i class="level-item fas fa-chevron-right"></i>
            </a>
        </div>
        
    </div>
</div>



</div>
                




<div class="column is-4-tablet is-4-desktop is-3-widescreen  has-order-1 column-left ">
    
        
<div class="card widget">
    <div class="card-content">
        <nav class="level" style="margin-bottom:1rem">
            <div class="level-item has-text-centered">
                <div>
                    
                        <img class="image is-96x96 has-mb-6" src="https://www.gravatar.com/avatar/e0f4032c0f2d1068ffffbaf93c0bef52?s=96" alt="Xinyu Liu">
                    
                    
                    <p class="is-size-4 is-block">
                        Xinyu Liu
                    </p>
                    
                    
                    <p class="is-size-6 is-block">
                        Alpha Lxy
                    </p>
                    
                    
                    <p class="is-size-6 is-flex is-flex-center has-text-grey">
                        <i class="fas fa-map-marker-alt has-mr-7"></i>
                        <span>Beijing, China</span>
                    </p>
                    
                </div>
            </div>
        </nav>
        <nav class="level menu-list is-mobile" style="margin-bottom:1rem">
            <div class="level-item has-text-centered is-marginless">
                <a href="/archives/">
                    <p class="heading">
                        Posts
                    </p>
                    <p class="title has-text-weight-normal">
                        40
                    </p>
                </a>
            </div>
            <div class="level-item has-text-centered is-marginless">
                <a href="/categories/">
                    <p class="heading">
                        Categories
                    </p>
                    <p class="title has-text-weight-normal">
                        13
                    </p>
                </a>
            </div>
            <div class="level-item has-text-centered is-marginless">
                <a href="/tags/">
                    <p class="heading">
                        Tags
                    </p>
                    <p class="title has-text-weight-normal">
                        0
                    </p>
                </a>
            </div>
        </nav>
        <div class="level">
            <a class="level-item button is-link is-rounded" href="https://www.github.com/AlphaLxy" target="_blank">
                <i class="fab fa-github"></i>&nbsp;&nbsp;Follow</a>
        </div>
        
        
    </div>
</div>

    
        
<div class="card widget column-left is-sticky" id="toc">
    <div class="card-content">
        <div class="menu">
            <h3 class="menu-label">
                Catalogue
            </h3>
            <ul class="menu-list"><li>
        <a class="is-flex" href="#Rust概念-所有权">
        <span class="has-mr-6">1</span>
        <span>Rust概念-所有权</span>
        </a><ul class="menu-list"><li>
        <a class="is-flex" href="#变量类型">
        <span class="has-mr-6">1.1</span>
        <span>变量类型</span>
        </a></li><li>
        <a class="is-flex" href="#变量绑定">
        <span class="has-mr-6">1.2</span>
        <span>变量绑定</span>
        </a></li><li>
        <a class="is-flex" href="#所有权">
        <span class="has-mr-6">1.3</span>
        <span>所有权</span>
        </a></li><li>
        <a class="is-flex" href="#复制行为">
        <span class="has-mr-6">1.4</span>
        <span>复制行为</span>
        </a></li><li>
        <a class="is-flex" href="#移动行为">
        <span class="has-mr-6">1.5</span>
        <span>移动行为</span>
        </a></li><li>
        <a class="is-flex" href="#克隆行为">
        <span class="has-mr-6">1.6</span>
        <span>克隆行为</span>
        </a></li></ul></li><li>
        <a class="is-flex" href="#引用和借用">
        <span class="has-mr-6">2</span>
        <span>引用和借用</span>
        </a><ul class="menu-list"><li>
        <a class="is-flex" href="#不可变引用">
        <span class="has-mr-6">2.1</span>
        <span>不可变引用</span>
        </a></li><li>
        <a class="is-flex" href="#可变引用">
        <span class="has-mr-6">2.2</span>
        <span>可变引用</span>
        </a></li></ul></li><li>
        <a class="is-flex" href="#slice-切片">
        <span class="has-mr-6">3</span>
        <span>slice 切片</span>
        </a></li></ul>
        </div>
    </div>
</div>


    
    
        <div class="column-right-shadow is-hidden-widescreen ">
        
        </div>
    
</div>

                
            </div>
        </div>
    </section>
    <footer class="footer">
    <div class="container">
        <div class="level">
            <div class="level-start has-text-centered-mobile">
                <a class="footer-logo is-block has-mb-6" href="/">
                
                    <img src="/images/logo.svg" alt="Rust概念-所有权" height="28">
                
                </a>
                <p class="is-size-7">
                &copy; 2020 Alpaca&nbsp;
                Powered by <a href="http://hexo.io/" target="_blank">Hexo</a> & <a
                        href="http://github.com/ppoffice/hexo-theme-icarus" target="_blank">Icarus</a>
                
                <br>
                <span id="busuanzi_container_site_uv">
                Visited by <span id="busuanzi_value_site_uv">0</span> users
                </span>
                
                </p>
            </div>
            <div class="level-end">
            
                <div class="field has-addons is-flex-center-mobile has-mt-5-mobile is-flex-wrap is-flex-middle">
                
                
                <p class="control">
                    <a class="button is-white is-large" target="_blank" title="CC BY-NC-SA 4.0" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
                        
                        <i class="fab fa-creative-commons"></i>&nbsp;<i class="fab fa-creative-commons-by"></i>&nbsp;<i class="fab fa-creative-commons-nc"></i>&nbsp;<i class="fab fa-creative-commons-sa"></i>&nbsp;
                        
                    </a>
                </p>
                
                <p class="control">
                    <a class="button is-white is-large" target="_blank" title="AlphaLxy GitHub" href="https://www.github.com/AlphaLxy">
                        
                        <i class="fab fa-github"></i>&nbsp;
                        
                    </a>
                </p>
                
                </div>
            
            </div>
        </div>
    </div>
</footer>

    <script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/moment@2.22.2/min/moment-with-locales.min.js"></script>
<script>moment.locale("en");</script>


    
    
    
    <script src="/js/animation.js"></script>
    

    
    
    
    <script src="https://cdn.jsdelivr.net/npm/lightgallery@1.6.8/dist/js/lightgallery.min.js" defer></script>
    <script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js" defer></script>
    <script src="/js/gallery.js" defer></script>
    

    
    

<div id="outdated">
    <h6>Your browser is out-of-date!</h6>
    <p>Update your browser to view this website correctly. <a id="btnUpdateBrowser" href="http://outdatedbrowser.com/" target="_blank" rel="noopener">Update
            my browser now </a></p>
    <p class="last"><a href="#" id="btnCloseUpdateBrowser" title="Close">&times;</a></p>
</div>
<script src="https://cdn.jsdelivr.net/npm/outdatedbrowser@1.1.5/outdatedbrowser/outdatedbrowser.min.js" defer></script>
<script>
    document.addEventListener("DOMContentLoaded", function () {
        outdatedBrowser({
            bgColor: '#f25648',
            color: '#ffffff',
            lowerThan: 'flex'
        });
    });
</script>


    
    
<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.5/unpacked/MathJax.js?config=TeX-MML-AM_CHTML" defer></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
    MathJax.Hub.Config({
        'HTML-CSS': {
            matchFontHeight: false
        },
        SVG: {
            matchFontHeight: false
        },
        CommonHTML: {
            matchFontHeight: false
        },
        tex2jax: {
            inlineMath: [
                ['$','$'],
                ['\\(','\\)']
            ]
        }
    });
});
</script>

    
    

<a id="back-to-top" title="Back to Top" href="javascript:;">
    <i class="fas fa-chevron-up"></i>
</a>
<script src="/js/back-to-top.js" defer></script>


    
    

    
    
    
    

    
    
    
    
    
    <script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.4/dist/clipboard.min.js" defer></script>
    <script src="/js/clipboard.js" defer></script>
    

    
    
    

    


<script src="/js/main.js" defer></script>

    
    <div class="searchbox ins-search">
    <div class="searchbox-container ins-search-container">
        <div class="searchbox-input-wrapper">
            <input type="text" class="searchbox-input ins-search-input" placeholder="Type something..." />
            <span class="searchbox-close ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="searchbox-result-wrapper ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
    (function (window) {
        var INSIGHT_CONFIG = {
            TRANSLATION: {
                POSTS: 'Posts',
                PAGES: 'Pages',
                CATEGORIES: 'Categories',
                TAGS: 'Tags',
                UNTITLED: '(Untitled)',
            },
            CONTENT_URL: '/content.json',
        };
        window.INSIGHT_CONFIG = INSIGHT_CONFIG;
    })(window);
</script>
<script src="/js/insight.js" defer></script>
<link rel="stylesheet" href="/css/search.css">
<link rel="stylesheet" href="/css/insight.css">
    
</body>
</html>